# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=libinput
pkgver=1.15.6
pkgrel=1
pkgdesc="Library for handling input devices"
url="https://www.freedesktop.org/wiki/Software/libinput"
arch="all"
license="MIT"
makedepends="eudev-dev libevdev-dev meson mtdev-dev"
checkdepends="diffutils bash"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-libs
	$pkgname-zsh-completion:zshcomp:noarch
	"
source="https://freedesktop.org/software/libinput/libinput-$pkgver.tar.xz"

build() {
	meson \
		--buildtype=plain \
		--prefix=/usr \
		--libdir=lib \
		-Ddocumentation=false \
		-Dlibwacom=false \
		-Ddebug-gui=false \
		-Dtests=false builddir/
	ninja -C builddir/
}

check() {
	cd "$builddir/builddir"
	ninja test
}

package() {
	DESTDIR="$pkgdir" ninja -C builddir/ install
}

libs() {
	default_libs

	mv "$pkgdir"/usr/lib/udev "$subpkgdir"/usr/lib
	mkdir -p "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/libinput "$subpkgdir"/usr/share
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	amove usr/share/zsh/site-functions
}

sha512sums="90459e5a1f22fd42ffcbab157b461e4514c30803bcebdaced76c65c05cccfa6f259640a50497055fe7ed0b376a6979f6d1d01227ae447fe60ba88fa81142b969  libinput-1.15.6.tar.xz"
